import comm from "@/common/common"

class notice{
	
	// 微信订阅消息
	wxNotice(notice){
		return new Promise((resolve, reject) =>{
			let than = this
			uni.requestSubscribeMessage({
				tmplIds: notice,
				success (res) {
					if(res.errMsg == 'requestSubscribeMessage:ok'){
						resolve(true)
					}else{
						comm.error(res.errCode+':'+res.errMsg);
						resolve(false)
					}
				},
				fail (res){
					comm.error(res.errMsg);
					resolve(false)
				}
			})
		})
	}
	
	//支付宝订阅消息
	alipayNotice(notice){
		return new Promise((resolve, reject) =>{
			// 示例
			my.getAuthCode({
				// 订单服务授权：order_service。如需同时获取用户多项授权，可在 scopes 中传入多个 scope 值。
				scopes: ['car_rental_auth'],
				success: (res) => {
					resolve(true)
				},
				fail: (res) => {
					resolve(false)
				},
			});
		})
	}
}
export default new notice();